<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/ui/";
%>

<!DOCTYPE HTML>
<html>
<head>
<base href="<%=basePath%>">
<title>观看实验</title>
<link href="css/bootstrap.css" rel="stylesheet" type="text/css"
	media="all" />
<!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
<script src="js/jquery.min.js"></script>
<!-- Custom Theme files -->
<!--theme-style-->
<link href="css/style.css" rel="stylesheet" type="text/css" media="all" />
<!--//theme-style-->
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="keywords"
	content="New Store Responsive web template, Bootstrap Web Templates, Flat Web Templates, Andriod Compatible web template, 
Smartphone Compatible web template, free webdesigns for Nokia, Samsung, LG, SonyErricsson, Motorola web design" />
<script type="application/x-javascript">
	
	
	
	 addEventListener("load", function() { setTimeout(hideURLbar, 0); }, false); function hideURLbar(){ window.scrollTo(0,1); } 



</script>
<!--fonts-->
<!--//fonts-->
<!-- start menu -->
<link href="css/memenu.css" rel="stylesheet" type="text/css" media="all" />
<script type="text/javascript" src="js/memenu.js"></script>

<script src="Scripts/swfobject_modified.js" type="text/javascript"></script>

<script>
	$(document).ready(function() {
		$(".memenu").memenu();
	});
</script>


<script src="js/main.js"></script>
<script src="js/simpleCart.min.js"></script>
<script type="text/javascript">
	function checkform() {
		var pstr = $("#pstr").val();
		var uid = $("#uid").attr("value");
		var flag = true;
		if (uid == "") {
			flag=false;
			alert("请先登录在发表自己的实验心得");
			return flag;
		} else if (pstr.trim() == "") {
			flag=false;
			alert("请填写回复内容");
			return flag;
		} else{
			window.location.reload();
			flag=true;
			return flag;
		}
		/*
		$.ajax({
			type : "POST",
			url : "/sypt/VideoServlet",
			async : false,
			dataType : "text",
			data : {
				"method" : "addComment",
				"uid" : uid,
				"pstr" : pstr,
				

			},
			success : function(data) {
				//刷新页面
			}
		});*/
		
	}
</script>
<script type="text/javascript">
	function dianzan(value) {
		var uid = $("#uid").attr("value");
		var spid = $("#spid").attr("value");
		var flag = true;
		if (uid == "") {
			flag = false;
			alert("请登录再收藏该实验");
			return flag;
		}
		////ajax刷新收藏数
		$.ajax({
			type : "POST",
			url : "/sypt/VideoServlet",
			async : false,
			dataType : "text",
			data : {
				"method" : "dianzan",
				"uid" : uid,
				"spid" : spid,
				"value":value

			},
			success : function(data) {
				if (data == "") {
					alert("您已经收藏过该视频，请不要重复收藏！");
				} else {
					var dianzan = data + "次收藏";
					$("#dianzan").html(dianzan);
				}
			}
		});

	}
</script>
<script type="text/javascript">
	function xiazai() {
		var uid = $("#uid").attr("value");
		var spid = $("#spid").attr("value");
		//var spurl="${video.spurl}";
		var flag = true;
		if (uid == "") {
			flag = false;
			alert("请登录再下载实验视频");
			return flag;
		}

		$.ajax({
			type : "POST",
			url : "/sypt/VideoServlet",
			async : false,
			dataType : "text",
			data : {
				"method" : "updatedown",
				"spid" : spid
			},
			success : function(data) {
				if (data == "") {
					alert("下载失败");
				} else {
					var down = data + "次下载";
					$("#downloadid").html(down);
				}
			}
		});
	}
</script>
<script type="text/javascript">
	function xiazaiwendang() {
		var uid = $("#uid").attr("value");
		var spid = $("#spid").attr("value");
		//var spurl="${video.spurl}";
		var flag = true;
		if (uid == "") {
			flag = false;
			alert("请登录再下载实验相关文档");
			return flag;
		}

		$.ajax({
			type : "POST",
			url : "/sypt/VideoServlet",
			async : false,
			dataType : "text",
			data : {
				"method" : "updatedown",
				"spid" : spid
			},
			success : function(data) {
				if (data == "") {
					alert("下载失败");
				} else {
				
				}
			}
		});
	}
</script>

</head>
<body>
	<!--header-->
	<%@include file="/ui/head.jsp"%>


	<!--content-->
	<!---->
	<div class="product">
		<div class="container">
			<div class="col-md-3 product-price">
				<div class=" rsidebar span_1_of_left">
					<div class="of-left">
						<h3 class="cate">实验分类</h3>
					</div>
					<ul class="menu">
						<c:forEach items="${sessionScope.list1 }" var="list1">
							<li class="item1"><a
								href="<c:url value='/BcategoryServlet?method=findByaid&aid=${list1.aid }'/>">${list1.aname }
							</a>
								<ul class="cute">
									<c:forEach items="${list1.bcategory }" var="list2">
										<li class="subitem1"><a
											href="<c:url value='/VideoServlet?method=findBybid&bid=${list2.bid }'/>">${list2.bname }
										</a></li>
									</c:forEach>
								</ul></li>
						</c:forEach>
					</ul>
				</div>

				<!--initiate accordion-->
				<script type="text/javascript">
					$(function() {
						var menu_ul = $('.menu > li > ul'), menu_a = $('.menu > li > a');
						menu_ul.hide();
						menu_a.click(function(e) {
							e.preventDefault();
							if (!$(this).hasClass('active')) {
								menu_a.removeClass('active');
								menu_ul.filter(':visible').slideUp('normal');
								$(this).addClass('active').next().stop(true,
										true).slideDown('normal');
							} else {
								$(this).removeClass('active');
								$(this).next().stop(true, true).slideUp(
										'normal');
							}
						});

					});
				</script>
				<!---->


				<!---->
				<div class="product-bottom">
					<div class="of-left-in">
						<h3 class="best">猜你喜欢</h3>
					</div>
					
					<c:forEach items="${tuijian }" var="tuijian">
					<div class="product-go">
						<div class=" fashion-grid" style="width: 100%">
<span class=" price-in1"> <a href="<c:url value='/VideoServlet?method=findByspid&spid=${tuijian.spid }'/>">${tuijian.spname }</a></span>
							<h6 class="best2">
								上传者：${tuijian.uname }
							</h6>
						</div>
						

						<div class="clearfix"></div>
					</div>
					</c:forEach>

				</div>
				<div class=" per1"></div>
			</div>
			<!-- 视频播放 -->
			<div class="col-md-9 product-price1">

				
				<!---->
				<div class="cd-tabs">
					<nav>
					<ul class="cd-tabs-navigation">

						<li><a data-content="television"
							href="<c:url value='/VideoServlet?method=download&uid=${sessionScope.user.uid }&spid=${video.spid }&spurl=${video.spurl }'/>"
							class="selected " onclick="return xiazai();">实验评论</a></li>

					</ul>
					</nav>
					<ul class="cd-tabs-content">


						<!-- 实验内容简介 -->
						<li data-content="television" class="selected">
							<div class="comments-top-top">
							<div class="top-comment-left">
										<img width="70px" height="70px"  src="../home/img/touxiang/${comm.user.uimage }"
											alt="">
									</div>
								<div class="top-comment-right" >
									<h6>
										<a href="javascript:void(0)">楼主:</a> ${comm.user.uname }
									</h6>
									<h6>
										<a href="javascript:void(0)">评论时间:</a> ${comm.ptime }
									</h6>

									<p>${comm.pstr }</p>
								</div>
								<div class="clearfix"></div>
								<a class="add-re" href="javascript:void(0)">回复列表</a>
							</div>

						</li>
						<!-- 评论区 -->
						<c:forEach items="${listReply }" var="reply">
							<li data-content="television" class="selected">
								<div class="comments-top-top">
									<div class="top-comment-left">
										<img width="70px" height="70px"  src="../home/img/touxiang/${reply.user.uimage }"
											alt="">
									</div>
									<div class="top-comment-right">
										<h6>
											<a href="javascript:void(0)">${reply.user.uname }</a>
											${reply.rtime }
										</h6>

										<p>${reply.rstr }</p>
									</div>
									<div class="clearfix"></div>

								</div>

							</li>
						</c:forEach>
						<li data-content="television" class="selected"><a
							class="add-re" href="javascript:void(0)">我的回复</a>
							<form name="form1" method="post"
								action="<c:url value='/VideoServlet'/>">
								<input type="hidden" name="method" value="addReply"> <input
									type="hidden" name="uid" id="uid"
									value="${sessionScope.user.uid }"> <input type="hidden"
									name="cid" id="cid" value="${comm.cid }">
								<div class="comments-top-top">
									<div class="top-comment-left">
										<img width="70px" height="70px" src="../home/img/touxiang/${sessionScope.user.uimage }" alt="">
									</div>
									<div class="top-comment-right">
										<textarea name="rstr" id="pstr" cols="80" rows="5"></textarea>
									</div>
									<div class="clearfix"></div>
									<input class="add-re" type="submit"
										onclick="return checkform();" value="回复">

								</div>
							</form></li>

						<div class="clearfix"></div>
					</ul>
				</div>
				
			</div>

			<div class="clearfix"></div>
		</div>
	</div>
	<!--//content-->
	<%@include file="/ui/foot.jsp"%>
</body>
</html>
